<?php
/*
 *   This file is part of poat.
 *
 *   poat is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   poat is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with poat.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *   Copyright (c) 2008 Sergio Gabriel Teves <gabriel.sgt at gmail.com>
 * 
 */

if (eregi("MSIE",getenv("HTTP_USER_AGENT")) ||
   eregi("Internet Explorer",getenv("HTTP_USER_AGENT"))) {
	Header("Location: ie_reject.html");
	exit;
}

include_once("includes/common.php");
require_once("class/user.class.php");

define('HOME',$link = "http://".HOST);
$homelink = "<a href='".HOME."' class='link'>&0</a>";
 
$tm->assign('CREDENTIALS',$CREDENTIALS);
$tm->assign('VERSION',VERSION);
$tm->assign('RELEASED',RELEASED);

# I DO NOT KNOW HOW TO CHECK IF AN ERROR OCCURS DURING UPLOAD. SO I'M CHECKING IF THE CONTENT LENGTH IS BIGGER THAN 5MB

if ($_SERVER['CONTENT_LENGTH']>5242880) {
	$param['action']='fileupload';
	$param['op']='error';
} 

$action=$param['action'];

$flow_ok = false;
$isadmin = false;

$o_flowid = $param['flowid'];
$s_flowid = $_SESSION['flowid'];
 
$flowid = util::hashcode("flowid");
$_SESSION['flowid'] = $flowid;
$tm->assign('flowid',$flowid);

if ($o_flowid == $s_flowid) {
	$flow_ok = true;
}

include("includes/processor.php");

$db->close();

unset($loader);
unset($db);

$tm->assign('message',$message);
$tm->assign('error',$error);		
$tm->assign('content',$content);
$tm->display('index.tpl');

?>
